﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using Orchard.ContentManagement;

namespace Szmyd.Orchard.Modules.Jumpstart.Models
{
    /// <summary>
    /// Content part, which is persisted in the database.
    /// </summary>
    public class PersistedPart : ContentPart<PersistedPartRecord>
    {
        /// <summary>
        /// String value. 
        /// Persisted parts properties are usually just a kind of "proxies" to the underlying record object.
        /// </summary>
        public string SomeString
        {
            get { return Record.SomeString; }
            set { Record.SomeString = value; }
        }

        /// <summary>
        /// Integer value. We decorate it with RequiredAttribute, so it will instantly become a required field.
        /// </summary>
        [Required]
        public int SomeInt
        {
            get { return Record.SomeInt; }
            set { Record.SomeInt = value; }
        }

        /// <summary>
        /// Persisted content parts can, of course, have properties that are not persisted in the db.
        /// You can eg. load it at some point if needed.
        /// </summary>
        public object SomeUnpersistedProperty { get; set; }
    }
}